package com.platform.system.system.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.system.system.model.Company;
import com.platform.system.system.model.dto.CompanyDto;
import com.platform.system.system.model.dto.CompanyQueryParam;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Set;

public interface CompanyService extends IService<Company> {

    /**
     * 查询所有数据不分页
     * @param query 条件参数
     * @return List<DeptDto>
     */
    List<CompanyDto> queryAll(CompanyQueryParam query, Boolean isQuery);

    List<CompanyDto> queryAll();

    List<Company> findByPid(long pid);

    /**
     * 获取待删除的部门
     * @param companyList /
     * @param companyIds /
     * @return /
     */
    Set<Long> getDeleteCompanys(List<Company> companyList, Set<Long> companyIds);

    /**
     * 根据ID获取同级与上级数据
     * @param companyDto /
     * @param companys /
     * @return /
     */
    List<CompanyDto> getSuperior(CompanyDto companyDto, List<Company> companys);

    /**
     * 构建树形数据
     * @param companyDtos /
     * @return /
     */
    Object buildTree(List<CompanyDto> companyDtos);

    /**
     * 获取
     * @param companyId
     * @param companyList
     * @return
     */
    List<Long> getCompanyChildren(Long companyId, List<Company> companyList);

    /**
     * 验证是否被角色或用户关联
     * @param companyIds /
     */
    void verification(Set<Long> companyIds);

    Company getById(Long id);
    CompanyDto findById(Long id);

    /**
     * 插入一条新数据。
     */
    boolean insert(Company resources);
    boolean modifyById(Company resources);
    boolean deleteById(Long id);
    boolean deleteByIds(Set<Long> ids);

    /**
     * 导出数据
     * @param all 待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<CompanyDto> all, HttpServletResponse response) throws IOException;

}
